﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ITD_VAPCF.NganQuy
{
    public class NganQuyServices : PluginInterfaces.IProjectPlugin
    {
        string _nodeName;
        System.Windows.Forms.Form _mainForm;
        #region IProjectPlugin Members

        public System.Windows.Forms.Form MainForm
        {
            get { return _mainForm; }
            set { _mainForm = value; }
        }
        public string NodeName
        {
            get { return _nodeName; }
            set { _nodeName = value; }
        }
        public string NameProject
        {
            get { return "Phân hệ Ngân quỹ"; }
        }
        public string Description
        {
            get { return ""; }
        }

        public string Author
        {
            get { return "Mai Hải Dương"; }
        }

        public string Version
        {
            get { return "2.0.0.1"; }
        }

        public void Initialize()
        {
            SelectNode();
        }

        public void Dispose()
        {
        }
        private bool CheckExistForm(string formName)
        {
            foreach (System.Windows.Forms.Form cForm in MainForm.MdiChildren)
            {
                if (cForm.Name == formName)
                {
                    cForm.Activate();
                    return true;
                }
            }
            return false;
        }
        private void SelectNode()
        {
            switch (_nodeName)
            {
                case "btnKKTM":
                    btnKKTM(null, null);
                    break;
                case "btnSLuongTienGD":
                    btnSLuongTienGD(null, null);
                    break;
                case "btnSLuongDoiTien":
                    btnSLuongDoiTien(null, null);
                    break;
                case "btnBaoTonQuy":
                    btnBaoTonQuy(null, null);
                    break;
                case "btnBKKQuyTienMat":
                    btnBKKQuyTienMat(null, null);
                    break;
            }
        }
        #region Thủ quỹ
        private void btnKKTM(object sender, EventArgs e)
        {
            if (!CheckExistForm("frmTT21_Kiem_Ke_Loai_Tien"))
            {
                Application.DoEvents();
                ITD_VAPCF.ThongTu21.GUI.frmTT21_Kiem_Ke_Loai_Tien childForm = new ITD_VAPCF.ThongTu21.GUI.frmTT21_Kiem_Ke_Loai_Tien();
                childForm.MaximizeBox = true;
                 childForm.MdiParent = MainForm;
                childForm.Show();
            }
        }
        private void btnSLuongTienGD(object sender, EventArgs e)
        {
            if (!CheckExistForm("frmDuyeGiaoDich"))
            {
                Application.DoEvents();
                ITD_VAPCF.NganQuy.GUI.frmDuyeGiaoDich childForm = new ITD_VAPCF.NganQuy.GUI.frmDuyeGiaoDich();
                 childForm.MdiParent = MainForm;
                childForm.Show();
            }
        }
        private void btnSLuongDoiTien(object sender, EventArgs e)
        {
            if (!CheckExistForm("frmKKTM_DoiTien"))
            {
                Application.DoEvents();
                ITD_VAPCF.NganQuy.GUI.frmDoiTienGiaoDich childForm = new ITD_VAPCF.NganQuy.GUI.frmDoiTienGiaoDich();
                childForm.MaximizeBox = true;
                 childForm.MdiParent = MainForm;
                childForm.Show();
            }
        }
        private void btnBaoTonQuy(object sender, EventArgs e)
        {
            ITD_VAPCF.NganQuy.GUI.frmTienMat frm = new ITD_VAPCF.NganQuy.GUI.frmTienMat();
            frm.StartPosition = FormStartPosition.CenterScreen;
            frm.Text = "Bảng kê tồn quỹ";
            frm.MODE = "BaocaoThuChi";
            frm.ShowDialog();

        }
        private void btnBKKQuyTienMat(object sender, EventArgs e)
        {
            ITD_VAPCF.NganQuy.GUI.frmTienMat frm = new ITD_VAPCF.NganQuy.GUI.frmTienMat();
            frm.StartPosition = FormStartPosition.CenterScreen;
            frm.Text = "Bảng kê tồn quỹ";
            frm.MODE = "BCKKQuyTienMat";
            frm.ShowDialog();

        }
        #endregion
        #endregion
    }
}
